/*
 * @Description: 系统通知
 * @Author: iamsmiling
 * @Date: 2021-06-07 13:20:55
 * @LastEditTime: 2021-06-09 16:45:12
 */
import 'package:credit_business_circle/R/R.dart';
import 'package:credit_business_circle/domain/remote/notification/notification_entity.dart';
import 'package:credit_business_circle/pages/message/children/system_notification/system_notification_controller.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class SystemNotificationPage extends GetView<SystemNotificationController> {
  const SystemNotificationPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("系统通知"),
        elevation: .5,
      ),
      body: GetBuilder<SystemNotificationController>(builder: (_) {
        return CustomScrollView(
          slivers: [
            SliverList(
                delegate:
                    SliverChildBuilderDelegate((BuildContext context, int i) {
              NotificationEntity item = _.notifications[i];
              return Container(
                margin: EdgeInsets.only(
                    top: R.dimen.dp12, left: R.dimen.dp10, right: R.dimen.dp10),
                padding: EdgeInsets.symmetric(
                    vertical: R.dimen.dp20, horizontal: R.dimen.dp13),
                decoration: BoxDecoration(
                    color: R.color.ffffffff,
                    borderRadius: BorderRadius.circular(R.dimen.sp10)),
                child: Row(
                  children: [
                    Container(
                      margin: EdgeInsets.only(right: R.dimen.dp5),
                      width: R.dimen.dp5,
                      height: R.dimen.dp5,
                      decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(R.dimen.sp5 / 2),
                          color: item.read
                              ? R.color.transparent
                              : R.color.fffb5058),
                    ),
                    Text(
                      item.message,
                      style: TextStyle(
                          fontSize: R.dimen.sp14,
                          color: R.color.ff111111,
                          fontWeight: FontWeight.w600),
                    ),
                    Spacer(),
                    Text(
                      item.date,
                      style: TextStyle(
                          color: R.color.ff999999, fontSize: R.dimen.sp12),
                    )
                  ],
                ),
              );
            }, childCount: _.notifications.length))
          ],
        );
      }),
    );
  }
}
